<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'book-form',
	'enableAjaxValidation'=>false,
	'htmlOptions' => array('enctype' => 'multipart/form-data'), 
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'name'); ?>
		<?php echo $form->textField($model,'name',array('size'=>50,'maxlength'=>50)); ?>
		<?php echo $form->error($model,'name'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'description'); ?>
		<?php echo $form->textArea($model,'description',array('rows'=>6, 'cols'=>50)); ?>
		<?php echo $form->error($model,'description'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'author'); ?>
		<?php echo $form->textField($model,'author',array('size'=>50,'maxlength'=>50)); ?>
		<?php echo $form->error($model,'author'); ?>
	</div>

	<div class="row">
	<!--<?php echo $form->labelEx($model,'check'); ?>-->
		<?php echo $form->hiddenField($model,'check'); ?>
	<!--<?php echo $form->error($model,'check'); ?>---->
	</div>

<!---	<div class="row">
		<?php echo $form->labelEx($model,'createddate'); ?>
		<?php echo $form->hiddenField($model,'createddate'); ?>
		<?php echo $form->error($model,'createddate'); ?>
	</div>
---->
	<div class="row">
		<!--<?php echo $form->labelEx($model,'idstaff'); ?>---->
		<?php echo $form->hiddenField($model,'idstaff'); ?>
		<!--<?php echo $form->error($model,'idstaff'); ?>---->
	</div>

<!---	<div class="row">
		<?php echo $form->labelEx($model,'iduser'); ?>
		<?php echo $form->textField($model,'iduser'); ?>
		<?php echo $form->error($model,'iduser'); ?>
	</div>
---->

	<div class="row">
		<?php echo chtml::label('Resource','Resource'); ?>
		<?php $this->widget('CMultiFileUpload', array(
                'name' => 'resources',
                'accept' => 'pdf|doc|docx|txt', // useful for verifying files
                'duplicate' => 'Duplicate file!', // useful, i think
                'denied' => 'Invalid file type', // useful, i think
            )); ?>
	</div>
	
	<div class="row">
		<?php echo chtml::label('URL Image','URL Image'); ?>
		<?php $this->widget('CMultiFileUpload', array(
                'name' => 'images',
                'accept' => 'jpg|gif', // useful for verifying files
                'duplicate' => 'Duplicate file!', // useful, i think
                'denied' => 'Invalid file type', // useful, i think
            )); ?>
	</div>
<!---	
	<div class="row">
		<?php echo $form->labelEx($model,'resource'); ?>
		<?php echo $form->textField($model,'resource',array('size'=>50,'maxlength'=>50)); ?>
		<?php echo $form->error($model,'resource'); ?>
	</div>
	
	<div class="row">
		<?php echo $form->labelEx($model,'urlimage'); ?>
		<?php echo $form->textField($model,'urlimage',array('size'=>50,'maxlength'=>50)); ?>
		<?php echo $form->error($model,'urlimage'); ?>
	</div>
--->
	<div class="row">
		<?php echo $form->labelEx($model,'downloadbookcount'); ?>
		<?php echo $form->textField($model,'downloadbookcount'); ?>
		<?php echo $form->error($model,'downloadbookcount'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'ratepoint'); ?>
		<?php echo $form->textField($model,'ratepoint'); ?>
		<?php echo $form->error($model,'ratepoint'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'rateclick'); ?>
		<?php echo $form->textField($model,'rateclick'); ?>
		<?php echo $form->error($model,'rateclick'); ?>
	</div>
    <div class="row">
		<?php echo chtml::label('Genre','genre'); ?></br>
        <?php $genres = Genre::model()->findAll(); ?>
		<?php $genreschecked = $model->isNewRecord? array(): $model->genres;  ?>
		<?php function iscontain($genreid,$arrayg){ foreach( $arrayg as $item) if($item->idgenre == $genreid) return true; return false; } ?>
        <?php foreach ($genres as $genre) { echo chtml::checkBox('Genre[name][]',iscontain($genre->idgenre,$genreschecked),array('value'=>$genre->idgenre)); echo Chtml::label($genre->name,'lb_'.$genre->name); echo '</br>';}  ?>
       
    </div>
	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->